<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>CTS系统登录界面</title>

  <link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css">
  <link rel="stylesheet" type="text/css" href="style/css/ext-patch.css">
  <link rel="stylesheet" type="text/css" href="style/css/style.css">

  <script type="text/javascript" src="../adapter/ext/ext-base.js"></script>
  <script type="text/javascript" src="../ext-all.js"></script>
  <script type="text/javascript" src="../ext-lang-zh_CN.js"></script>
  <script type="text/javascript" src="pub/cookie.js"></script>
  <script type="text/javascript" src="pub/message.js"></script>

  <script type="text/javascript">
    
    var cookieNameStr = 'controlcenterloginid';
    var sk = GetCookieVal('ccsk');
  
    Ext.onReady(function (){
    	Ext.QuickTips.init();
        Ext.form.Field.prototype.msgTarget = 'side';
    /*
     * ================  Login form  =======================
     */
    var loginFormPanel = new Ext.FormPanel({
        labelWidth: 60,
        labelAlign: 'right',
        labelSeparator: ':   ',
        bodyStyle:'padding:17px 17px 0',
        width: 370,
        defaults: {width: 230},
        defaultType: 'textfield',
        items: [{
                fieldLabel: '登录ID',
                id:'loginName',
                name: 'loginName',
                allowBlank:false
            },{
                inputType:'password',
                fieldLabel: '密码',
                id:'password',
                name: 'password',
                allowBlank:false
         }],
        keys: [{
            key: [10,13],
            fn: function(){
                userlogin();
            }
        }]
    });
    var windowLogin = new Ext.Window({
        title: "CTS系统登陆",
        width: 400,
        height:180,
        draggable: true,
        collapsed: false,
        layout: 'fit',
        closable:false,
        collapsible:false,
        plain:true,
        modal:true,
        resizable:false,
        bodyStyle:'padding:11px;',
        buttonAlign:'center',
        items: loginFormPanel,
        buttons: [{
            text: "登录",
               type: 'submit',
               handler:userlogin
            },{
               text: "重置",
               handler:function(){loginFormPanel.form.reset();}
    		}]
    });
    windowLogin.show();
    function userlogin(){
      if(!loginFormPanel.form.isValid()){return;}
    		progressMessageBoxShow('正在登录...',"");
    		loginFormPanel.form.doAction('submit',{
    			//url:'php/login.php',
    			url:'/user/login/login/',
    			method:'POST',
    			params:{
    			    //null
    			},
    			success:function (form,action){
    				if(action.result.result == 1){
    					SetCookie(cookieNameStr,Ext.get('loginName').dom.value,777);
    					window.location.href=action.result.msg;
    				}else{
    					Ext.MessageBox.hide();
    					SwitchResult(action.result);
    				}
    			},
    			failure:function (){Ext.MessageBox.hide();alertAjaxFailure();}
    		});                                     
    }
    var uidvalue=GetCookieVal(cookieNameStr);
    if(uidvalue != '')loginFormPanel.form.setValues(eval('({"loginName":"'+uidvalue+'"})'));
    });
    
    </script>
</head>
<body>
  <!--<div id="header"><h1>CTS系统登录界面</h1></div>-->
</body>
</html>
